#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int dominantIndex(int* nums, int numsSize) {
    int i = 0;
    int max = nums[0];
    int x = 0;
    for (i = 0; i < numsSize; i++) {
        if (nums[i] > max) {
            max = nums[i];
            x = i;
        }
    }
    for (i = 0; i < numsSize; i++) {
        if (i == x)continue;
        if (nums[i] * 2 > max) {
            break;
        }
    }
    if (i == numsSize)return x;
    else
        return -1;
}
int main() {
    int a[] = { 3,6,1,0 };
    int n = dominantIndex(a, 4);
    printf("%d", n);
    return 0;
}